home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / vim-tiny.prerm < prev    next >
Encoding:
Text File  |  2007-05-22  |  1.5 KB  |  61 lines

  1. #!/bin/bash -e
  2.  
  3. pkg=vim-tiny
  4. variant=tiny
  5.  
  6. # two things to do:
  7. # 1) remove /usr/bin/vim.variant as alternative for /usr/bin/vim
  8. # 2) remove /usr/bin/gvim as an alternative for gnome-text-editor for
  9. #    variants built with gnome support
  10.  
  11. # check_and_remove_alternative cleans up stale alternatives that were left
  12. # behind from previous mishandling of alternatives.
  13. check_and_remove_alternative () {
  14.   if update-alternatives --list $1 | grep -q bin/vim; then
  15.     for f in `update-alternatives --list $1 | grep 'bin/vim$'`; do
  16.       update-alternatives --remove $1 $f
  17.     done
  18.   fi
  19. }
  20.  
  21. remove_gnome_alternative () {
  22.   if [ -f /usr/bin/vim.$variant ]; then
  23.     check_and_remove_alternative gnome-text-editor
  24.     update-alternatives --remove gnome-text-editor /usr/bin/vim.$variant
  25.   fi
  26. }
  27.  
  28. remove_variant_alternative () {
  29.   for i in vi view ex editor rvim rview vimdiff vim; do
  30.     check_and_remove_alternative $i
  31.     update-alternatives --remove $i /usr/bin/vim.$variant
  32.   done
  33.   case "$variant" in
  34.     gtk|lesstif|perl|python|ruby|tcl|gnome|full) # gui enabled variants
  35.       remove_gui_variant_alternative
  36.       ;;
  37.   esac
  38. }
  39.  
  40. remove_gui_variant_alternative () {
  41.   for i in eview evim gview gvimdiff rgview rgvim gvim; do
  42.     check_and_remove_alternative $i
  43.     update-alternatives --remove $i /usr/bin/vim.$variant
  44.   done
  45. }
  46.  
  47. case "$1" in
  48.   remove)
  49.     case "$pkg" in
  50.       vim-gnome|vim-full) # gnome enabled variants
  51.         remove_gnome_alternative
  52.     ;;
  53.     esac
  54.     remove_variant_alternative
  55.     ;;
  56. esac
  57.  
  58.  
  59.  
  60. exit 0
  61.